import { Pipe, PipeTransform } from '@angular/core';

/**
 * 数组拼装，默认逗号拼装
 */
@Pipe({ name: 'join' })
export class JoinPipe implements PipeTransform {
  transform(value, args: string[]): any {
    let separator = ',';
    if (args && args.length > 0) {
      separator = args[0];
    }
    return value && value.length > 0 ? value.join(separator) : '';
  }
}
